if [ $(whoami) != "root" ];then
	echo "请使用root权限执行Java环境删除命令！"
	exit 1;
fi
echo -e "\033[1;32mWelcome to UninstallJava\033[0m"

read -p "输入yes删除: " yes;
if [ "$yes" != "yes" ];then
	echo -e "------------"
	echo "取消删除"
	exit;
fi
echo -e "----------------------------------------------------"
echo "删除硬链接"
rm -f /usr/bin/jdk
echo -e "----------------------------------------------------"
echo "删除Java环境配置"
sed -i '/JAVA_HOME/d' /etc/profile
echo -e "----------------------------------------------------"
echo "生效配置的环境"
source /etc/profile
echo -e "----------------------------------------------------"
echo "完成java环境配置，请重启"
read -p "输入yes重启: " yes;
if [ "$yes" == "yes" ];then
	echo -e "------------"
	reboot
	exit;
fi